package _0928.bookmanagement;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class BookDaoImplTest {
	
	BookDaoImpl impl = new BookDaoImpl();
	
	@Before
	public void addTest() {
		Book b1 = new Book(1, "a", "aa", 11.11);
		Book b2 = new Book(2, "b", "bb", 12.11);
		Book b3 = new Book(3, "c", "cc", 13.11);
		Book b4 = new Book(4, "d", "dd", 14.11);
		Book b5 = new Book(5, "e", "ee", 15.11);
		
		impl.add(b1);
		impl.add(b2);
		impl.add(b3);
		impl.add(b4);
		impl.add(b5);
	}	
	
	@Test
	public void updateTest() {
		Book bb2 = new Book(2, "www", "www", 120.11);
		impl.update(bb2);
	}
	
	@Test
	public void removeTest() {
		impl.remove(3);
	}
	
	@Test
	public void selectById() {
		System.out.println(impl.selectById(1));
	}
	@After
	public void selectAllTest() {
		Book[] selectAll = impl.selectAll();
		for(Book s : selectAll) {
			System.out.println(s);
		}
	}
}
